package models

import (
	"github.com/astaxie/beego/orm"
	"fmt"
)

type SysRnk struct {
	Id        int    `orm:"column(id);auto"`
	RankName  string `orm:"column(rank_name);size(10)" description:"排行榜名称"`
	RankImage string `orm:"column(rank_image);size(255)" description:"背景图"`
	IsDelete  int8   `orm:"column(is_delete)" description:"逻辑删除"`
}

func (t *SysRnk) TableName() string {
	return "sys_rnk"
}

func init() {
	orm.RegisterModel(new(SysRnk))
}

func GetAllSysRnk() ([]*SysRnk, error) {
	o := orm.NewOrm()
	sysRanks := make([]*SysRnk,0)
	_, err := o.Raw("select * from sys_rnk").QueryRows(&sysRanks)
	if err != nil {
		fmt.Println("select sys_rnk error.", err)
		return nil,err
	}
	return sysRanks,nil
}



